<!DOCTYPE html>
<html>
<!-- Mirrored from www.zi-han.net/theme/hplus/login.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:18:23 GMT -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>PG 保洁主题 - 登录</title>

    <meta name="csrf-token" content="{{ csrf_token() }}">

    <link rel="shortcut icon" href="favicon.ico"> <link href="/login/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="/login/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/login/css/custom.css" rel="stylesheet">
    <link href="/login/css/animate.min.css" rel="stylesheet">
    <link href="/login/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>if(window.top !== window.self){ window.top.location = window.location;}</script>
    <script src="/jquery/jquery.js"></script>
    <script src="/layui/layui.js"></script>
</head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div>

                <h1 class="logo-name">PG</h1>

            </div>
            <h3>欢迎使用 PG</h3>

            <form class="m-t" role="form" action="" method="post" id="form">
                @csrf
                <div class="form-group">
                    <input type="email" class="form-control" placeholder="用户名" name="name" id="name" required="">
                </div>
                <div class="form-group">
                    <input type="password" class="form-control" placeholder="密码" name="pwd" id="pwd" required="">
                </div>
                <button type="button" id="submit" class="btn btn-primary block full-width m-b" style="background:#01AFF0;">登 录</button>

                <p class="text-muted text-center"> <a href="login.html#"><small>忘记密码了？</small></a> | <a href="/register">注册一个新账号</a>

                </p>
            </form>
        </div>
    </div>
   <script>
        $(function(){
            $('#submit').click(function () {
                $.ajaxSetup({
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    }
                });
                var form = $('#form').serialize();
                var name =  $('#name').val();
                var pwd = $('#pwd').val();
                layui.use('layer', function() {
                    var layer = layui.layer;
                    if (!name) {
                        layer.msg('用户名不能为空');
                        location.href = '/login_index';
                        return false;
                    }
                    if (!pwd) {
                        layer.msg('密码不能为空');
                        location.href = '/login_index';
                        return false;
                    }
                });
                $.get({
                    url:"login_check",
                    data: form,
                    success:function (data) {
                        layui.use('layer', function(){
                            var layer = layui.layer;
                            if(data.code=='1') {
                                layer.open({
                                    title: '登录'
                                    , skin: 'msg'
                                    , content: data.name
                                    , yes: function () {
                                        location.href = data.url;
                                }
                             });
                            }else if(data.code=='-1'){
                                layer.open({
                                    title: '登录'
                                    , skin: 'msg'
                                    , content: data.name
                                    , yes: function () {
                                        location.href = '/login_index';
                                    }
                                });
                            }else if(data.code=='-2'){
                                layer.open({
                                    title: '登录'
                                    , skin: 'msg'
                                    , content: data.name
                                    , yes: function () {
                                        location.href = '/login_index';
                                    }
                                });
                            }
                        });
                     }
                });
                return false;
            });
        });
    </script>
</body>


<!-- Mirrored from www.zi-han.net/theme/hplus/login.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:18:23 GMT -->
</html>
